let sorder = [];

$(function () {
    let vue = new Vue({
        el: "#app",
        data: {
            orderList:sorder
        },
        methods: {
            sign:function(orderId){
                $.ajax({
                    url: '/order/updateStatus',
                    type: 'post',
                    data: {
                        "id":orderId,
                        "status":1
                    },
                    dataType: 'json',
                    success: function (result) {
                        layer.msg("签到成功");
                        window.location.reload();
                    }
                })
            },
            evaluate:function (orderId) {
                $.ajax({
                    url: '/order/updateStatus',
                    type: 'post',
                    data: {
                        "id":orderId,
                        "status":2
                    },
                    dataType: 'json',
                    success: function (result) {
                        layer.msg("已评价");
                        window.location.reload();
                    }
                })
            }
        }
    });
})


$.ajax({
    url: '/order/fy/list',
    type: 'post',
    dataType: 'json',
    success: function (result) {
        for(let i=0;i<result.length;i++){
            let list = {
                "id":result[i].aid,
                "mechanism":result[i].course.ctitle,
                "service":result[i].course.csummary,
                "address":result[i].mechanism.maddress,
                "status":result[i].ustatus,
                "date":result[i].adate,
                "time":result[i].atime
            };
            sorder.push(list);
        }
    }
});